package com.ss.cfg;

/**
 * edge of control flow graph
 * @author WangJie
 */
public class Edge implements Comparable<Edge>{

	private int edgeID;
	
	private Node headNode;
	
	private Node tailNode;
	
	private String name;

	public Edge(int edgeID, Node headNode, Node tailNode) {
		super();
		this.edgeID = edgeID;
		this.headNode = headNode;
		this.tailNode = tailNode;
	}
	
	public Edge(String name, Node headNode, Node tailNode) {
		super();
		this.name = name;
		this.headNode = headNode;
		this.tailNode = tailNode;
	}
	

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public int getEdgeID() {
		return edgeID;
	}

	public void setEdgeID(int edgeID) {
		this.edgeID = edgeID;
	}

	public Node getHeadNode() {
		return headNode;
	}

	public void setHeadNode(Node headNode) {
		this.headNode = headNode;
	}

	public Node getTailNode() {
		return tailNode;
	}

	public void setTailNode(Node tailNode) {
		this.tailNode = tailNode;
	}

	@Override
	public int compareTo(Edge o) {
		if(edgeID == o.getEdgeID()){
			return 0;
		}else if(edgeID > o.getEdgeID()){
			return 1;
		}else {
			return -1;
		}
	}
}
